package com.tech.zhidengxian.controller;

import com.tech.zhidengxian.model.dto.SchoolDTO;
import com.tech.zhidengxian.model.dto.result.ReturnResult;
import com.tech.zhidengxian.model.dto.result.ReturnResultUtils;
import com.tech.zhidengxian.service.api.SchoolService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/school")
public class SchoolController {
    @Resource
    private SchoolService schoolService;
    @RequestMapping("/querySchoolByCity")
    public ReturnResult<List<SchoolDTO>> querySchoolByCity(String city){
        return ReturnResultUtils.returnSuccess(schoolService.selectListByCity(city));
    }

    @RequestMapping("/querySchoolByName")
    public ReturnResult<List<SchoolDTO>> querySchoolByName(String keyword){
        return ReturnResultUtils.returnSuccess(schoolService.selectListByName(keyword));
    }
}
